using System;
using System.Xml;
using System.IO;
using System.Collections;

using Icodeon;

using NUnit.Framework;

namespace Icodeon.Util
{
    [TestFixture]
    public class JSharpUtilsTest : BaseTest
    {
        private IZipUtils zipUtils;
        private FileInfo zipFile;

        [TestFixtureSetUp]
        public void Init()
        {
            this.SetUp();


            IOUtils ioUtils = new IOUtils();

            //Input
            DirectoryInfo scormPackages =
                ioUtils.CombineParentAndChildDirectoryNames(this.rootDirectory, "packages");
            this.zipFile = ioUtils.CombineDirectoryNameAndFileName(scormPackages, "scorm_1p2_sco.zip");

            //this.scormPackageDirectory = ioUtils.CombineParentAndChildDirectoryNames(this.rootDirectory, "ziptest");
            //ioUtils.MakeDirectoriesInPath(this.scormPackageDirectory);




        }

        [TestFixtureTearDown]
        public void Dispose()
        {
        }

        [Test]
        public void TestZip()
        {
            IOUtils ioUtils = new IOUtils();

            try
            {
                this.zipUtils = new ZipUtilsJSharp();
                this.zipUtils.UnZipFiles(null, this.zipFile, this.scormPackageDirectory, null, false);

                FileInfo outputZip = ioUtils.CombineDirectoryNameAndFileName(this.scormPackageDirectory, "test.zip");
                this.zipUtils.ZipFiles(null, this.scormPackageDirectory, outputZip, null, 0);
            }
            catch (Exception e)
            {
                System.Console.WriteLine(e.Message);
                if (e.InnerException != null)
                {
                    System.Console.WriteLine(e.InnerException.Message);
                }
                System.Console.WriteLine(e.StackTrace);
                Assert.Fail(e.Message);
            }
        }
    }
}
